package user;

import book.BookList;
import operation.*;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-05-19
 * Time: 19:20
 */
public class NormalUser extends User{
    public NormalUser(String name) {
        super(name);
        IOperations = new IOperation[4];
        IOperations[1] = new SearchOperation();
        IOperations[2] = new BorrowOperation();
        IOperations[3] = new ReturnOperation();
        IOperations[0] = new ExitOperation();
    }

    public int menu(){
        System.out.println("1、查找图书");
        System.out.println("2、借阅图书");
        System.out.println("3、归还图书");
        System.out.println("0、退出系统");
        System.out.println("输入您的选择：");
        Scanner scan = new Scanner(System.in);
        return scan.nextInt();
    }

    public void doOperations(int choice, BookList bookList){
        IOperations[choice].work(bookList);
    }
}
